
// Copyright (c) 2012, 2013 All Right Reserved, http://hpc.utp.edu.my
// Author: Nordin Zakaria nordinzakaria@gmail.com
// All rights reserved.

#include <stdlib.h>
#include<cmath>
using namespace std;

#ifndef RAND_CLASS
#define RAND_CLASS

#define PI 3.14159265358979323846

//! A class that encapsulates functions for generating random numbers
/*!
    The Random class contains only static functions, 
	and should therefore be instantiated. 
 */
class Random
	{
	private:

	//! A (private) function for generating random number with a Gaussian distribution.
	/*!
		Extracted from: http://www.dreamincode.net/code/snippet1446.htm
		\param mu      the mean of the distribution
		\param sigma   the standard deviation
	*/
	static double randn(double mu=0.0, double sigma=1.0);

	//! keep constructor private to prevent instantiation
	Random(){}

	public:

	//! A function for initialization of the random number generation
	static void init() {
	       }

	//! A function for generating random number with a Gaussian distribution.
	static double getGaussian(double mean, double sdv)
		{
		return randn(mean, sdv);
		}

	//! A function for generating random integer 
	/*!
		\param n the maximum (exclusive) integer value
	*/
	static long getInt(int n)
		{
		int i = rand() % n;
		return i;
		}

	};

#endif

